<?php

namespace App\Model;

class UsersModel extends BaseModel
{

    protected $table = 'users';

    protected $primaryKey = 'user_id';

    protected $fillable = [
        'headimgurl',
        'openid',
        'nickname',
        'user_phone',
        'spread_id',
        'point_uid',
        'point_uid_spread_price_id',
        'point_uid_index',
    ];


    public function vipInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(VipSettingsModel::class,'vip_index','vip_index');
    }

    public function spreadInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(UsersModel::class,'user_id','spread_id');

    }
    public function pointInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(UsersModel::class,'user_id','point_uid');

    }

}
